﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;

namespace WebSiteBuilder.CatalogParts
{
    public class TextBoxCatalogPart : CatalogPart
    {
        public TextBoxCatalogPart()
        {
            this.ID = Guid.NewGuid().ToString();
        }

        public override WebPartDescriptionCollection GetAvailableWebPartDescriptions()
        {
            return new WebPartDescriptionCollection(new List<WebPartDescription>() { new WebPartDescription("TextBox", "TextBox", "This is a custom web part", "http://epsshared.hosting.wellsfargo.com/c/common/images/wellsfargo_logo_standard_48.gif") });
        }

        public override WebPart GetWebPart(WebPartDescription description)
        {
            switch (description.Title)
            {
                case "TextBox":

                    var webPart = WebPartManager.CreateWebPart(new TextBox { ID = Guid.NewGuid().ToString() });

                    return webPart;

                default:
                    return null;
            }
        }
    }
}